<?

require_once  $_SERVER['DOCUMENT_ROOT']."/../_lib/base/common.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.template.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holidays.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.destinations.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.weather.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.lurls.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.photos.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.tree.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.breadcrumb.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holiday_top_deals.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.airports.php";

	$template = new template();
	$lurls = new lurls();
	$destinations = new destinations();
	$weather = new weather();
	$photos = new photos();
	$breadcrumb = new breadcrumb();
	$airports = new airports();
	$tree = new tree();
	
	// get the destination values
	$params['tree_id'] = $_GET['tree_id'];
	$params['cache']['seconds'] = '2400';
	$destination_values = $tree->get_branch($params,1);
	$destination_values = $destination_values[0];
	unset($params);
	
	
	
	
	
	
	// If not found then send to 404 error
	if(!$destination_values){
		header("HTTP/1.0 404 Not Found"); 
		include($_SERVER['DOCUMENT_ROOT']."/404.php");
		exit;
	}
	
	// get child destinations
	$params['type_id'] = '1';
	$params['parent_id'] = $_GET['tree_id'];
	//$params['cache']['seconds'] = '2400';
	$child_destinations = $tree->get_children($params);
	unset($params);
	
	// get child resorts
	$params['type_id'] = '2';
	$params['parent_id'] = $_GET['tree_id'];
	//$params['cache']['seconds'] = '2400';
	$child_resorts = $tree->get_children($params);
	unset($params);
        
        
	$child_resorts = $child_resorts;
	unset($params);

	if(!empty($child_resorts)){
		foreach($child_resorts as $value){
			$child_resorts_string .= $value['name'].", ";
		}
	}
	
	
	// get photos
	$cache['seconds'] = '2400';
	$destination_photos = $photos->get_photos($destination_values['tree_id'], $cache);
	unset($cache);
	if($destination_photos){
		$lead_hotel_thumb_url = UPLOAD_HTTP_PERM.$destination_photos[0]['photo_url_thumb'];
	}
	
	// Get Yahoo weather reports
	$cache['seconds'] = '2400';
	$weather_day_reports = $weather->fetch_reports($destination_values['yahoo_weather_location_id'], $cache);
	unset($cache);



	
	// Template
	$template->title = $destination_values['name']." Holidays, Book Online, About ".$destination_values['name'];
	$template->meta_description = "Cheap holidays to ".$destination_values['name']." from Ireland. Information about ".$destination_values['name'].", things to do, resorts and weather in ".$destination_values['name'].".";
	$template->section_highlight = "guides";
	$template->left_col = true;
	
	$template->breadcrumbs_html = $breadcrumb->get_html_breadcrumb($destination_values['lineage']);	
	$template->ld_head();
	
	




	

?>




<h2>About <?= $destination_values['name'] ?> Holidays</h2>


<!-- Start column -->

<div class="col_400 margin_right_10">


<? 


if($destination_photos){

?>

<div class="div_photo_left">
<div class='thumb_cover_div'>
<a href="#"><img src="<?= $lead_hotel_thumb_url ?>" alt="<?= $destination_values['name'] ?>" class="thumb_image_100" />
<img src="/images/thumb_cover_100_74.gif" class="thumb_cover" alt="<?= $destination_values['name'] ?>" /></a>	
</div>
</div>

<?

} 
?>



<?= $destination_values['description']; ?>




<? include SITE_ROOT_PATH."/_lib/html/destination_details_tabs.php"; ?>




</div>
<!-- End column -->














<!-- Start column -->
<div class='col_200'>




<!-- Start map -->

<? if($destination['map_image_url']){ ?>
<p title="<?= $destination_values['name'] ?> map"><img src="<?= UPLOAD_HTTP_PERM.$destination['map_image_url'] ?>" alt="<?= $destination_values['name'] ?> map" /></p>
<? } ?>

<!-- End map -->






<? if($child_destinations){ ?>

<!-- Start child destinaions -->

<h4><?= $destination_values['name'] ?> destinations</h4>

<ul class="list_qlinks">
<?
	foreach($child_destinations as $value){
		$lurl = $lurls->get_branch_lurl($value['tree_id']);
		unset($params);
		echo "<li><a href='".$lurl."'>".$value['name']."</a></li>";
	}
?>
</ul>

<!-- End child destinations -->

<? } ?>













<? if($child_resorts AND !$child_destinations){ ?>


<!-- Start child resorts -->


<h4><?= $destination_values['name'] ?> Resorts</h4>

<ul class="list_qlinks">
<?


	foreach($child_resorts as $value){
		$lurl = $lurls->get_branch_lurl($value['tree_id']);
		echo "<li><a href='".$lurl."'>".$value['name']."</a></li>";
	}
?>
</ul>

<!-- End child resorts -->


<? } ?>



<? 

$top_deals = new holiday_top_deals();
$params = array();
$params['destination_airport'] = $destination_values['airport_code_search'];
$params['limit'] = '8';

$destination_deals = $top_deals->get_top_deals_destination($params);
unset($params);
if($destination_deals){ 

?>


<!-- Start holiday deals -->

<h4><?= $destination_values['name'] ?> Holidays</h4>

<ul class="list_qlinks">
<?

	foreach($destination_deals as $values_top_deals){
	

		// Get destination using airport code and name synonyms as paramaters
		$params['airport_code'] = $values_top_deals['destination_airport'];
		$params['type_id'] = '1';
		$params['position'] = 'bottom';
		$destination_values = $destinations->destination_lookup($params);
		unset($params);
		
		// Get departure airport
		$params['airport_code'] = $values_top_deals['departure_airport'];
		$item_departure_airport = $airports->get_airport($params);
		unset($params);
		
		$url_string = $lurls->holiday_list_lurl($values_top_deals);
	
?>

	<li><?= display_sabs_date($values_top_deals['departure_date'],'jS F') ?>, <?= $values_top_deals['nights'] ?>nts, from <?= $item_departure_airport['simple'] ?> <a class="price_med" href="<?= $url_string ?>">&euro;<?= $values_top_deals['price']; ?></a></li>
    
<?

}

?>	
</ul>

<!-- End holiday deals -->


<? } ?>






<div class="box_std">

<script type="text/javascript"><!--

google_ad_client = "pub-0942262475991955";

/* 180x150, created 09/07/09 */

google_ad_slot = "7520128694";

google_ad_width = 180;

google_ad_height = 150;

//-->

</script>

<script type="text/javascript"

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script></div>
























<!-- End column -->
</div>




<?

$template->ld_foot();


	
	
?>